﻿using System;
using System.Collections.Generic;
using System.Text;
using DevExpress.Xpo;
using Component;

namespace Component
{
    public class IntroductionDB:Base 
    {

        /// <summary>
        /// public static XPCollection<Introduction> GetAll()
        /// </summary>
        /// <returns>XPCollection<Introduction></returns>
        public static XPCollection<Introduction> GetAll(bool admin)
        {
            XPCollection<Introduction> _xpIntroduction = new XPCollection<Introduction>(KetNoiCSDL.session);
            _xpIntroduction.Filter = FilterAll(admin);
            _xpIntroduction.Sorting = SetupSort(ColumIntroductionImg._Priority,true);
            return _xpIntroduction;
        }
        /// <summary>
        /// public static Introduction GetObjectByid(int id)
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static Introduction GetObjectByid(int id, bool admin)
        {
            XPCollection<Introduction> _xpIntroduction = new XPCollection<Introduction>(KetNoiCSDL.session);
            _xpIntroduction.Filter = FilterById(id);
                return _xpIntroduction[0];
        }  
    }
}
